<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 什么叫做浅拷贝 
            只拷贝一层
        */
        let userInfo = {
            username:"文渊",
            age:98,
            gender:"男",
            address:{
                addressInfo1:"江西",
                addressInfo2:"深圳"
            },
            hobby:["唱","跳","run","篮球","miusic"]
        } 
        //重新开辟一个空间
        let studentInfo = {}


        /* 开始浅拷贝 */
        for(let key in userInfo){
            studentInfo[key] = userInfo[key]
        }
        // userInfo.username = "王八"
        userInfo.address.addressInfo1 = "长沙"

        console.log(userInfo,studentInfo);
    </script>
</body>

</html>